Skip to content

Conversation

@huangdijia
Copy link

@huangdijia huangdijia commented Sep 30, 2025

Summary

  • Extracts attribute merging logic into a new compileAttributes() method for better code organization
  • Properly structures log attributes with namespaced keys (log.context, log.extra, log.channel)
  • Maintains existing sentry.origin attribute functionality

Changes

  • Added compileAttributes() protected method to LogsHandler class
  • Replaced inline array_merge() call with method call for better readability
  • Improved attribute organization with proper namespacing

Test plan

  • Verify existing Monolog integration tests pass
  • Confirm log attributes are properly structured in Sentry
  • Ensure sentry.origin attribute is still set correctly

Note

Cursor Bugbot is generating a summary for commit 9dcb383. Configure here.

Link #1929

@huangdijia
Copy link
Author

@cleptric I have recreated a PR and resolved the issue where merging caused data to be overwritten

@Litarnus
Copy link
Contributor

Hi @huangdijia! Could you look at the failing CI?

Also, please do not introduce an additional namespace. This will change the shape of the data and it might break existing things.

We also changed the value of sentry.origin here: #1938

@huangdijia
Copy link
Author

huangdijia commented Oct 23, 2025

Hi @huangdijia! Could you look at the failing CI?

Also, please do not introduce an additional namespace. This will change the shape of the data and it might break existing things.

We also changed the value of sentry.origin here: #1938

It has been handled

…andler

Extracts the attribute merging logic into a new compileAttributes() method
for better organization and readability. The new method properly structures
log attributes with namespaced keys (log.context, log.extra, log.channel)
while maintaining the existing sentry.origin attribute.
@huangdijia huangdijia force-pushed the refactor/monolog-logs-handler-attributes branch from 921493a to a20fe76 Compare October 24, 2025 01:17
Updated the compileAttributes method to use array_merge instead of array spread syntax for compatibility and clarity when merging context, extra, and additional attributes.
cursor[bot]

This comment was marked as outdated.

Changed the 'sentry.origin' attribute from 'auto.logger.monolog' to 'auto.log.monolog' in the compileAttributes method for consistency or integration requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants